  Encoder_refresh_time = millis();
    while((millis()-Encoder_refresh_time)<Encoder_sample_time)//在采样时间内对编码器计数(四倍频)
    {
      if(LEFT_A==HIGH && LEFT.A_flag==0){
        LEFT.A_val++;
        LEFT.A_flag=1;
        }
      if(LEFT_A==LOW && LEFT.A_flag==1){
        LEFT.A_val++;
        LEFT.A_flag=0;
        }
      if(LEFT_B==HIGH && LEFT.B_flag==0){
        LEFT.B_val++;
        LEFT.B_flag=1;
        }
      if(LEFT_B==LOW && LEFT.B_flag==1){
        LEFT.B_val++;
        LEFT.B_flag=0;
        }
    }
    Encoder_refresh_time = millis();
    while((millis()-Encoder_refresh_time)<Encoder_sample_time)//在采样时间内对编码器计数(四倍频)
    {
      if(RIGHT_A==HIGH && RIGHT.A_flag==0){
        RIGHT.A_val++;
        RIGHT.A_flag=1;
        }
      if(RIGHT_A==LOW && RIGHT.A_flag==1){
        RIGHT.A_val++;
        RIGHT.A_flag=0;
        }
      if(RIGHT_B==HIGH && RIGHT.B_flag==0){
        RIGHT.B_val++;
        RIGHT.B_flag=1;
        }
      if(RIGHT_B==LOW && RIGHT.B_flag==1){
        RIGHT.B_val++;
        RIGHT.B_flag=0;
        }
    }

    LEFT.speed=(LEFT.A_val+LEFT.B_val)/(Encoder_sample_time/1000);//计算转速
    RIGHT.speed=(RIGHT.A_val+RIGHT.B_val)/(Encoder_sample_time/1000);//计算转速
    //清零储存脉冲数的值
    LEFT.A_val=0;LEFT.B_val=0;
    RIGHT.A_val=0;RIGHT.B_val=0;